/*
 * City Router
 * @Author: chiangbt@geoportal.cn 
 * @Date: 2019-05-07 11:29:51 
 * @Last Modified by: chiangbt@geoportal.cn
 * @Last Modified time: 2019-05-09 10:22:31
 */
const express = require('express');
const router = express.Router();
const jwt = require('express-jwt');
const cityController = require('../controllers/cityController');

router.post('/cities', jwt({
    secret: process.env.SecretOrPublicKey
}), cityController.create_city);

router.get('/cities', cityController.city_get_all);

router.get('/cities/:id', jwt({
    secret: process.env.SecretOrPublicKey
}), cityController.city_get_by_id);

router.delete('/cities/:id', jwt({
    secret: process.env.SecretOrPublicKey
}), cityController.delete_city);

router.patch('/cities/:id', jwt({
    secret: process.env.SecretOrPublicKey
}), cityController.update_city);

router.get('/cities/geo/near', jwt({
    secret: process.env.SecretOrPublicKey
}), cityController.city_search_near);

module.exports = router;